package com.foreknow.demo12;

/**
 * static 关键字
 */
public class Student {
    public String name;
    public static int count;

    public void say(){
        //静态方法可以被普通方法调用
        Student.language();
        System.out.println("说话");
    }
    public static void language(){
        //静态方法中不能调用非静态方法，除非要调用的方法也是static
        
        System.out.println("语言");
    }


    public static void main(String[] args) {
        Student s1 = new Student();
        s1.name="fender";
        s1.count=1;


        Student s2 = new Student();
        s2.name="gibson";
        s2.count=100;

        System.out.println(s1.name);
        System.out.println(s1.count);
        System.out.println();
        System.out.println(s2.name);
        System.out.println(s2.count);
        //调用静态方法只需要通过 ：类名.方法名(参数)
        Student.language();
        //非静态方法一定要通过对象来调用 对象名.方法名（参数）
        s1.say();
        s2.say();
    }



}
